<template>
  <div>
    <div class="Position" id="jobBox">
      <div
        class="Position-box"
        v-for="(item, index) in jobList"
        :key="index"
        @click="handleDetails(item,index)"
      >
        <div class="Position-content-top">
          <p class="Position-name">{{ item.jobName }}</p>
          <!-- <div class="guide-app-download-icon"></div> -->
          <p class="Position-price">{{ item.salaryDesc }}</p>
        </div>
        <p class="Position-content-center">
          {{ item.cityName }}
          <span class="vline"></span>
          {{ item.jobExperience }}
          <span class="vline"></span>
          {{ item.jobDegree }}
        </p>
        <div class="Position-content-bottom">
          <p><img :src="item.brandLogo" alt="" /></p>
          <a href="###" class="Position-content-bottom-info">
            <span class="name">{{ item.brandName }}</span>
            <span class="type">{{ item.brandIndustry }}</span>
            <span class="vline"></span>
            <span class="level">已上市</span>
          </a>
        </div>
      </div>
    </div>
    <button class="position-btn" @click="handleClick">查看更多</button>
  </div>
</template>

<script>
// import axios from 'axios'
export default {
  components: {},
  data() {
    return {
      jobList: [],
    }
  },
  computed: {},
  watch: {},
  created() {
    this.getJobList()
  },
  mounted() {},
  methods: {
    // 查看更多职位信息按钮
    handleClick() {
      var jobBox = document.getElementById('jobBox')
      var jobHeight = jobBox.clientHeight
      if (jobHeight <= 2190) {
        jobBox.style.height = jobHeight + 438 + 'px'
      }
      if (jobHeight > 2628) {
        jobBox.style.height = '2920px'
      }
      // this.$request.get('/api/wapi/zpgeek/recommend/job/list.json?expectId=173334697&pk=cpc_job_index_beijing&sortType=2&page=1&salary=&payType=&degree=&experience=&stage=&scale=&districtCode=&businessCode=n')
      // .then(res => {
      //   console.log(res)
      // })
      // const params = {
      //   pname: "李元智",
      //   page: "35",
      //   psex: "男"
      // }
      // console.log(params)
      // this.$request.get('/api/api/UserInfo/GetInfo')
      // .then(res => {
      //   console.log(res)
      // })
      // axios.get('/api/api/ZpInfo/GetInfo')
      // .then(res => {
      //   console.log(res)
      // })
      // axios.get('/api/c/i/position/recommend?at=3cdfb7d2007841b093773a2d7771a1ec&rt=6306e718123b48e5a0e83e6de26d0053&resumeNumber=JI905168451R90500000000&resumeVersion=1&platform=13&version=0.0.0&eventScenario=pcRecommendIIndex&_v=0.47848514&x-zp-page-request-id=98c68e3127cf42d9a335356826b9c2cf-1618829273108-273347&x-zp-client-id=3e3f89f5-b145-4f87-96b8-edeca16bbf7a')
      // .then(res => {
      //   console.log(res)
      // })
      // this.$request.get(
      //   '/wapi/zpCommon/data/position.json'
      // ).then((res) => {
      //   console.log(res)
      // })
    },
    handleDetails(item,index) {
      // console.log(item,index);
      // console.log(item.encryptJobId);
      sessionStorage.setItem('jobDetail',JSON.stringify(item))
      let routeData = this.$router.resolve({
        path:'/positiondetails'
      })
      window.open(routeData.href, '_blank');
      
    },
    getJobList() {
      this.$request.get('/yapi/jobList').then((res) => {
        // console.log(res)
        this.jobList = res.zpData.jobList
      })
    },
  },
}
</script>
<style scoped>
.Position {
  width: 1184px;
  height: 438px;
  overflow: hidden;
  margin: auto;
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-content: flex-start;
  flex-wrap: wrap;
  align-items: center;
}
.Position-box {
  width: 344px;
  height: 90px;
  background-color: #fff;
  margin-right: 16px;
  margin-bottom: 16px;
  padding: 20px;
  cursor: pointer;
}
.Position-box:hover{
  box-shadow: 2px 2px 20px #c7c5c5;
  transform: scale(1.01);
}
.Position-box:hover .Position-name{
  color: #55cbc4;
}
.Position > .Position-box:nth-child(3n) {
  margin-right: -10px;
}
.Position-content-top {
  display: flex;
  width: 100%;
  align-items: center;
}
.Position-name {
  position: relative;
  max-width: 200px;
  font-size: 15px;
  color: #414a60;
  margin-right: 8px;
  line-height: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* .guide-app-download-icon{
  display: inline-flex;
    width: 15px;
    height: 13px;
    background: url(../images/guide-add-download-icon.png) no-repeat;
    background-size: 100% 100%;
} */
.Position-price {
  font-size: 15px;
  color: #fd7240;
  line-height: normal;
  flex: 1;
  text-align: right;
  max-width: none;
}
.Position-content-center {
  font-size: 13px;
  color: #8d92a1;
  padding-right: 0;
  line-height: 28px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vline {
  display: inline-block;
  width: 1px;
  height: 12px;
  vertical-align: middle;
  background: #e0e0e0;
  margin: 0 10px;
}
.Position-content-bottom {
  border-top: 1px solid #eef0f5;
  display: flex;
  margin-top: 8px;
  padding-top: 12px;
}
.Position-content-bottom > p {
  font-size: 14px;
  width: auto;
  padding-right: 0;
  border: 1px solid #f3f5fb;
  border-radius: 4px;
  line-height: normal;
}
.Position-content-bottom > p > img {
  width: 30px;
  height: 30px;
}
.Position-content-bottom-info {
  font-size: 13px;
  color: #8d92a1;
  display: flex;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.Position-content-bottom-info > .name {
  margin-left: 10px;
  margin-right: 20px;
  color: #61687c;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.Position-content-bottom-info > .type {
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.Position-content-bottom-info > .level {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.position-btn {
  width: 200px;
  height: 40px;
  margin-left: 50%;
  transform: translateX(-50%);
  margin-top: 50px;
  margin-bottom: 50px;
  color: #fff;
  font-size: 16px;
  background-color: #55cbc4;
  border: none;
  cursor: pointer;
  outline: none;
}
.position-btn:hover {
  background-color: #5dd5cb;
}
</style>